import { connect, Dispatch } from 'umi';
import { ConnectState } from '@/pages/demo/models/connect';

import PlayGround from '../page';
const mapStateToProps = ({ demoFormRenderStore }: ConnectState) => ({
  ...demoFormRenderStore,
});

const mapDispatchToProps = (dispatch: Dispatch) => ({
  schemaChange: (str: string) => {
    dispatch({
      type: 'demoFormRenderStore/schemaChange',
      payload: str,
    });
  },
  setFormData: (data: any) => {
    dispatch({
      type: 'demoFormRenderStore/setFormData',
      payload: data,
    });
  },
});

export default connect(mapStateToProps, mapDispatchToProps)(PlayGround);
